package com.bigdata.movieticketapi.controller;

import com.bigdata.movieticketapi.common.pojo.PageResult;
import com.bigdata.movieticketapi.service.IChargeService;
import com.bigdata.movieticketapi.vo.req.*;
import com.bigdata.movieticketapi.vo.resp.PageCancelOrderRespVO;
import com.bigdata.movieticketapi.vo.resp.PageChargeRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 充值表 前端控制器
 * </p>
 *
 * @author movie
 * @since 2023-11-15
 */
@RestController
@RequestMapping("/api")
@Api(tags = "充值模块")
@EnableTransactionManagement
public class ChargeController {

    @Resource
    private IChargeService iChargeService;

    @PostMapping("/admin/charge/create")
    @ApiOperation(value = "创建充值卡密接口")
    public void createCharge(@RequestBody @Valid CreateChargeReqVO vo){
        iChargeService.createCharge(vo);
    }

    @PostMapping("/admin/charge/do")
    @ApiOperation(value = "充值接口")
    public void doCharge(@RequestBody @Valid DoChargeReqVO vo){
        iChargeService.doCharge(vo);
    }

    @PostMapping("/admin/charge")
    @ApiOperation(value = "分页接口")
    public PageResult<PageChargeRespVO> pageCharges(@RequestBody @Valid PageChargeReqVO vo){
        return iChargeService.pageCharges(vo);
    }
}
